|
|
|
|
|
|
|
You have given the ADO Data control everything it needs to bring data into your program. However, most likely you'll want to display that data somehow so that the user can view, browse, and even edit it. You learned how to use a bound control in Chapter 25, ''The Data Control and Data-Bound Controls." For the sample project, draw five text boxes on the form, as shown in Figure 28.7. These text boxes will display the publisher's name, address, city, state, and ZIP code. |
|
|
|
|
|
|
|
|
Figure 28.7
You can bind text boxes to specific recordset fields. |
|
|
|
|
|
|
|
|
Next, you need to bind each control to a data field. To do so, set the DataSource property of each text box to the name of the ADO Data control, ADODC1, and the DataField property to the appropriate field name. After you finish setting the DataSource and DataField properties for each text box, run the sample project. You should be able to browse through the database and view or edit information, as shown in Figure 28.8. |
|
|
|
|
|
|
|
|
Figure 28.8
Although the completed sample project is somewhat
crude looking, it is fully functional and requires no code. |
|
|
|
|
|
|
|
|
As you navigate through the recordset using the buttons on the ADO Data control, each bound text box is automatically updated to display the contents of the current record. If you want to use bound controls to display more than one record at a time, you need to use a specialized control such as the DataGrid control, discussed later in the "Using the DataGrid Control" section. |
|
|
|
|
|